const {exec,escape} = require('../db/mysql.js')
const {mdPassword} = require('../utils/cryp')
const login = (usernamem,password)=>{
   usernamem = escape(usernamem)
   password = escape(mdPassword(password))
  const sql = `select username,realname from users where username=${usernamem} and password=${password} `
  return exec(sql).then(rows=>{
    return rows[0] || {}
  })
}
module.exports={
  login
}